import { IItemArray } from '@/components/SearchForm'
import { STATUSOPTIONS } from '@/constant'
import { IAppSelect, IOptionType } from './types'
export const useFormAdd = ({
  onMenuChange,
  onPathChange,
  data,
  appList,
}: {
  onMenuChange: (val: string, ev: any) => void
  onPathChange: (val: React.ChangeEvent<HTMLInputElement>) => void
  data: IOptionType
  appList: IAppSelect
}): IItemArray[] => {
  return [
    {
      name: 'org_name',
      label: '组织名称',
      type: 'Select',
      option: STATUSOPTIONS,
      placeholder: '请选择组织名称',
      rules: [
        {
          required: true,
          message: '请选择组织名称',
        },
      ],
    },
    {
      name: 'app_name',
      label: '所属应用',
      type: 'Select',
      option: STATUSOPTIONS,
      placeholder: '请选择所属应用',
      rules: [
        {
          required: true,
          message: '请选择所属应用',
        },
      ],
    },
    {
      name: 'role_name',
      label: '角色名称',
      type: 'Input',
      placeholder: '请输入角色名称',
      rules: [
        {
          required: true,
          message: '请输入角色名称',
        },
      ],
      config: {
        showCount: true,
        maxLength: 30,
      },
    },
    {
      name: 'role_desc',
      label: '角色描述',
      type: 'TextArea',
      placeholder: '请输入角色描述',
      rules: [
        {
          required: true,
          message: '请输入角色描述',
        },
      ],
      config: {
        showCount: true,
        maxLength: 100,
      },
    },
  ]
}
